<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>html的事件</title>
		<script>
			function init()
			{
				var ar=document.getElementsByTagName("input");
				for(var i=0;i<ar.length;i++)
				{
					if(ar[i].type!='button')continue;
					ar[i].onclick=function(){
						alert(this.value+"按钮被点击了@！！");
					}
				}
			}
		</script>
	</head>
	<body onload="init()">
		<input type="button" value="click1"/>
		<input type="button" value="click2"/>
		<input type="button" value="click3"/>
		<input type="button" value="click5"/>
		<input type="button" value="click16" />
		
		<input type="button" value="click8"/>
		
	</body>
</html>
